import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {Backend} from '../../providers/backend';
import {ImagePipe} from '../../pipes/pipes';
import {Platform} from 'ionic-angular';
@Component({
  templateUrl: 'build/pages/tab-events/tab-previous-video.html',
  pipes: [ImagePipe],
})
export class TabVideo {

  static get parameters() {
    return [[NavController], [NavParams],[Backend],[Platform]];
  }

  constructor(nav, params,backend,platform) {
    this.nav = nav;
    this.params = params;
    this.backend = backend;
    this.platform = platform;
    this.item = params.get('item');
    this.title = params.get('title');
    this.id = params.get('id');
    if (this.platform.is('android')) {
      this.isAndroid = true;
    }
    
    this.fuwu='http://10.3.10.1:17001/app-portal/app/download?f=';
    console.log(this.item);
    this.backend.dsFind({
      e: params.data.item.item.id + '-timelineEvent-edit'
    }).then((result) => {
      console.log(result);
      
      this.videos = result.video;
      // this.meetingfile=result.video[0].id.substring(result.video[0].id.length-36,result.video[0].id.length);
      // this.fuwu='http://10.3.10.5:17001/app-portal/app/download?f='+this.meetingfile;
      console.log(this.videos,8989);
      console.log(this.fuwu);
      // loading.dismiss();
    });
  }
  playVideo(video){
    var videoEle = document.querySelector('#'+video.id.replace('gtig$',''));
    if (!video.play) {
      videoEle.play();
      video.play = true;
    } else {
      videoEle.pause();
      video.play = false;
    }

  }

}